<template>
	<view >
		<u-toast ref="uToast" />
		<u-popup v-model="show" mode="center">
			<view class="input-box u-p-20">
				<input type="number" v-model="money" placeholder="请输入提现金额" />
			</view>
			<view class="btn-box u-p-20">
				<view class="btn" @click="withdrawClick">立即提现</view>
			</view>
		</u-popup>

	</view>
</template>

<script>
	export default {
		props: {
			show: false
		},
		data() {
			return {
				money: null,
			}
		},
		methods: {
			withdrawClick() {
				if (this.money == 0 || this.money == null) {
					this.$refs.uToast.show({
						title: '请输入正确金额'
					})
				} else {
					this.myhttp({
						url: '?s=/api/user/addWithdrawal',
						data: {
							price: this.money
						}
					}).then(res => {
						if (res.status == 200) {
							this.money = ''
							this.$emit('hide')
							this.$refs.uToast.show({
								title: '申请成功，请等待后台审核打款哦'
							})
						} else {
							this.$refs.uToast.show({
								title: res.message
							})
						}
					})
				}

			}
		}
	}
</script>

<style lang="scss">
	.input-box {
		width: 710upx;
		margin: 0 auto 40upx;

		input {
			border: 1px solid #F4F4F4;
			background-color: #F4F4F4;
			border-radius: 8upx;
			padding: 10upx 20upx;
			margin-top: 20upx;
		}
	}

	.btn-box {
		display: flex;
		justify-content: center;
		align-items: center;

		.btn {
			width: 562upx;
			height: 88upx;
			background: #212121;
			opacity: 1;
			border-radius: 44upx;
			font-size: 30upx;
			font-family: PingFang SC;
			color: #FFFFFF;
			text-align: center;
			line-height: 88upx;
		}
	}
</style>
